@model CreateOpenIdScopeViewModel
@using OrchardCore.OpenId.ViewModels;

<h1>@RenderTitleSegments(T["Create a new scope"])</h1>

<div asp-validation-summary="ModelOnly"></div>
<form asp-action="Create" method="post">
    <div class="form-group" asp-validation-class-for="Name">
        <label asp-for="Name">@T["Name"]</label>
        <input asp-for="Name" class="form-control" autofocus />
        <span asp-validation-for="Name" class="text-danger"></span>
    </div>

    <div class="form-group" asp-validation-class-for="DisplayName">
        <label asp-for="DisplayName">@T["Display Name"]</label>
        <input asp-for="DisplayName" class="form-control" />
        <span asp-validation-for="DisplayName" class="text-danger"></span>
    </div>

    <div class="form-group" asp-validation-class-for="Description">
        <label asp-for="Description">@T["Description"]</label>
        <textarea asp-for="Description" class="form-control"></textarea>
        <span asp-validation-for="Description" class="text-danger"></span>
    </div>

    <div class="form-group" id="TenantGroup" name="TenantGroup">
        <h6>@T["Tenants"]</h6>
        @for (var index = 0; index < Model.Tenants.Count; index++)
        {
            <input type="hidden" asp-for="Tenants[index].Name" />
            <div class="custom-control custom-checkbox">
                <input type="checkbox" class="custom-control-input" asp-for="Tenants[index].Selected" disabled="@Model.Tenants[index].Current">
                <label class="custom-control-label" asp-for="Tenants[index].Selected">@Model.Tenants[index].Name</label>
            </div>
        }
    </div>

    <div class="form-group" asp-validation-class-for="Resources">
        <label asp-for="Resources">@T["Additional resources (API audiences)"]</label>
        <input asp-for="Resources" class="form-control" />
        <span asp-validation-for="Resources" class="text-danger"></span>
    </div>

    <div class="form-group">
        <button class="btn btn-primary" type="submit">@T["Save"]</button>
        <a class="btn btn-secondary" asp-route-action="Index">@T["Cancel"]</a>
    </div>
</form>
